-- @owner: @zou_jialiang050
-- @date: 2023/2/20
-- @testpoint: create function 使用原有语法创建函数指定M*侧函数选项，成功

--step1:建表;expect:成功
drop table if exists t_create_function_0028;
drop table if exists t_create_function_0028_1;
create table t_create_function_0028(id1 int, id2 int, id3 int);
create table t_create_function_0028_1(id1 int, id2 int, id3 int);

--step2:create function 使用原有语法创建函数指定M*侧函数选项;expect:成功
create or replace function f_create_function_0028() returns trigger contains sql as
$$
declare
begin
insert into t_create_function_0028_1 values(new.id1, new.id2, new.id3);
return new;
end;
$$ language plpgsql;
/
create trigger tri_create_function_0028 before insert on t_create_function_0028
for each row
execute procedure f_create_function_0028();
/
insert into t_create_function_0028 values(100,200,300);
select * from t_create_function_0028;
select * from t_create_function_0028_1;
select pg_get_functiondef('f_create_function_0028'::regproc::oid);

--step3:清理环境;expect:成功
drop trigger if exists tri_create_function_0028;
drop function if exists f_create_function_0028;
drop table if exists t_create_function_0028;
drop table if exists t_create_function_0028_1;